﻿using System;
using System.Security.AccessControl;
using Company.IO.Interfaces;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Company.System.IO.IntegrationTests
{
    public partial class DirectoryTest : TestBase<IDirectory>
    {
        private const string _SSetAccessControlMethodName = "SetAccessControl";

        [TestMethod]
        [Ignore]
        public void SetAccessControl_PathValid_CreationTime()
        {
            //Arrange
            string path = SLocalPath;
            var expected = new DirectorySecurity(path, AccessControlSections.All);

            //Act
            Directory.SetAccessControl(path, expected);

            //Assert
            DirectorySecurity actual = global::System.IO.Directory.GetAccessControl(path);
            Assert.AreEqual(expected.AccessRightType.GUID, actual.AccessRightType.GUID);
        }

        [TestMethod]
        public void SetAccessControl_PathNull_ArgumentNullException()
        {
            //Arrange
            Type[] parameterTypes = GetTypeArray<string, DirectorySecurity>();
            object[] parameterValues = GetValueArray(SStringNull, new DirectorySecurity());

            //Act
            ExpectException<ArgumentNullException>(_SSetAccessControlMethodName, parameterTypes, parameterValues);

            //Assert
        }

        [TestMethod]
        public void SetAccessControl_PathEmpty_ArgumentException()
        {
            //Arrange
            Type[] parameterTypes = GetTypeArray<string, DirectorySecurity>();
            object[] parameterValues = GetValueArray(string.Empty, new DirectorySecurity());

            //Act
            ExpectException<ArgumentException>(_SSetAccessControlMethodName, parameterTypes, parameterValues);

            //Assert
        }
    }
}